<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="root">
        <!-- inc为自定义事件 -->
        <!-- click为原生事件 -->
        <!-- 给组件绑定原生事件在原生事件后面加上.native(原生事件.native) -->
        <counter @inc="handleIncrease" @click.native="handleClick"></counter>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var counter={
            props:['count'],
            template:"<div @click='handleClick'>{{count}}</div>",
            methods:{
                handleClick:function(){
                    this.$emit('inc',1);
                }
            }
        }
        var app=new Vue({
            el:"#root",
            components:{
                counter:counter
            },
            data:{
                total:0
            },
            methods:{
                handleIncrease:function(){

                },
                handleClick:function(){

                }
            }
        })
    </script>
</body>
</html>